/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.isen.WebApplicationSpringTemperature.controller;


import com.isen.WebApplicationSpringTemperature.bean.Employee;
import com.isen.WebApplicationSpringTemperature.bean.EmployeeList;
import com.isen.WebApplicationSpringTemperature.bean.Temperature;
import com.isen.WebApplicationSpringTemperature.database.TemperatureHelper;
import com.isen.WebApplicationSpringTemperature.ds.EmployeeDS;
import java.io.StringReader;
import java.util.List;

import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamSource;

import org.springframework.oxm.jaxb.Jaxb2Marshaller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;



@Controller
public class TemperatureController {
    private TemperatureHelper temperatureHelper;
	
	public void setTemperatureHelper(TemperatureHelper ds) {
		this.temperatureHelper = ds;
	}
	
	private Jaxb2Marshaller jaxb2Mashaller;
	
	public void setJaxb2Mashaller(Jaxb2Marshaller jaxb2Mashaller) {
		this.jaxb2Mashaller = jaxb2Mashaller;
	}

	private static final String XML_VIEW_NAME = "temperatures";
	
	@RequestMapping(method=RequestMethod.GET, value="/temperature/{id}")
	public ModelAndView getEmployee(@PathVariable String id) {
		List e = temperatureHelper.getTemperatureByID(Integer.parseInt(id));
		return new ModelAndView(XML_VIEW_NAME, "object", e.get(0));
	}
//	
//	@RequestMapping(method=RequestMethod.GET, value="/employees")
//	public ModelAndView getEmployees() {
//		List<Employee> employees = employeeDS.getAll();
//		EmployeeList list = new EmployeeList(employees);
//		return new ModelAndView(XML_VIEW_NAME, "employees", list);
//	}
}
